<?php

	class AddDirFileCommand implements ICommand
	{
		public function execute($event)
		{
			$filepath = $event->data["name"];
		
			if (!file_exists(ROOT.$filepath))
			{
				if (strpos($filepath,".") === false)
				{
					mkdir($ROOT.$filepath);
				}
				else
				{		
					file_put_contents(ROOT.$filepath,"");
				}
				
				return true;
			}
			else
			{
				throw new Error("The file already exists!");
			}
		}	
	}